package com.itheima.job7;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Test {
    public static void main(String[] args) {
        Student student1 = new Student("s001", "张三", 23);
        Student student2 = new Student("s002", "李四", 23);
        Student student3 = new Student("s003", "李四", 23);
        //1.先用map集合存储学号-学生对象的map集合
        Map<String,Student> class1 = new HashMap<>();
        class1.put(student1.getId(),student1);
        class1.put(student2.getId(),student2);
        class1.put(student3.getId(),student3);
        Map<String,Student> class2 = new HashMap<>();
        class2.put(student1.getId(),student1);
        class2.put(student2.getId(),student2);
        class2.put(student3.getId(),student3);
        Map<String,Student> class3 = new HashMap<>();
        class3.put(student1.getId(),student1);
        class3.put(student2.getId(),student2);
        class3.put(student3.getId(),student3);
        //2.用list集合存储map
        List<Map<String,Student>> students = new ArrayList<>();
        students.add(class1);
        students.add(class2);
        students.add(class3);
        //students.forEach(student-> System.out.println(student));
        for (Map<String, Student> classed : students) {
            classed.forEach((key,value)-> System.out.println(key+" "+value));
        }
    }

}
